<?php

declare(strict_types=1);

namespace app\store\controller\tools;

use app\store\controller\Controller;
use think\App;
use think\response\Json;
use app\store\service\tools\Statistics as StaticService;

class Statistics extends Controller
{

    private $staticService;
    public function __construct(App $app,StaticService $staticService)
    {
        parent::__construct($app);
        $this->staticService = $staticService;

    }

    public function codePreview():Json
    {
        $type = $this->request->get('type',0);
        $res = $this->staticService->getCodePreview($type);
        if(!$res){
            return $this->renderError('获取异常');
        }
        return $this->renderSuccess($res);
    }





}